﻿package engine.game.world {
	import engine.base.GameBase;
	import flash.display.BitmapData;
	import flash.geom.Point;
	import flash.geom.Rectangle;
	import engine.managers.AssetManager;
	
	/**
	* This class represents Tiles that reside within maps
	* @author Jon Smelquist
	*/
	public class Tile{

		private var _imageLayers:Vector.<int>;
		private var _position:Point;
		
		// is player blocked from crossing a border of this tile
		// ie. You can walk on the tile but not leave or enter from the north (the edge of a cliff)
		private var _blocks:Boolean;

		public function get position():Point { return _position; }
		public function get imageLayers():Vector.<int> { return _imageLayers; }
		public function get blocks():Boolean { return _blocks; }
		public function set blocks(value:Boolean):void { _blocks = value; }

		/**
		 * Constructor for the Tile.
		 * 
		 * @param	_baseLayerImageData	An array representing the any number of image information that make up waht the player walks on.
		 * @param	position	Position of the Tile within the map.
		 * @param	blockNorth	Does this tile block north movement?
		 * @param	blockSouth	Does this tile block south movement?
		 * @param	blockEast	Does this tile block east movement?
		 * @param	blockWest	Does this tile block west movement?
		 */
		public function Tile(baseTileNum:int, position:Point, blocks:Boolean) {
			//_display = new BitmapData(32, 32, true, 0x00000000);
			_imageLayers = new Vector.<int>();
			_position = position;
			
			addImageLayer(baseTileNum);
			
			_blocks = blocks;
		}
	
		/**
		 * Add the specified layer of data to the tile. Image layers are arrays to allow for frames of animation within the tile.
		 * 
		 * @param	imageDataLayer	The layer of image data (1..n frames) to add. 
		 */
		public function addImageLayer(tileNum:int):void {
			_imageLayers.push(tileNum);
		}
		
	}	
}